from django import forms

from groundtruth.location.models import LocationType, Photo

class GeocodeForm(forms.Form):
    q = forms.CharField(label='Near Location', help_text='e.g., "10 market st, san francisco" or "59.871111, -155.339722"')
    lat = forms.CharField(widget=forms.HiddenInput, required=False)
    lng = forms.CharField(widget=forms.HiddenInput, required=False)
    radius_choices = ('5', '5'), ('15', '15'), ('25', '25'), ('50', '50'), ('100', '100'), ('250', '250'), ('500', '500')
    radius = forms.ChoiceField(label='Radius (miles)', choices=radius_choices, initial='50')
    #layers = forms.ModelChoiceField(queryset=LocationType.objects.all(), empty_label='-- All Areas --', widget=forms.SelectMultiple)
    layers = forms.ModelChoiceField(queryset=LocationType.objects.all(), empty_label=None, widget=forms.CheckboxSelectMultiple)

class KeywordForm(forms.Form):
    q = forms.CharField(label='Name or Keywords')
    location = forms.CharField(label='Near Location')
    lat = forms.CharField(widget=forms.HiddenInput, required=False)
    lng = forms.CharField(widget=forms.HiddenInput, required=False)
    layers = forms.ModelChoiceField(queryset=LocationType.objects.all(), empty_label=None, widget=forms.CheckboxSelectMultiple)
    
class PhotoUploadForm(forms.ModelForm):
    class Meta:
        model = Photo
        exclude = ('location') 
    